package ro.myApp.articles.entities;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.hibernate.validator.NotNull;

@Entity
@DiscriminatorValue("REV")
public class Review extends Publication {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5834296979878537248L;

	@ManyToOne(fetch=FetchType.LAZY)
	@NotNull
	private Article publication;

	@OneToMany(cascade=CascadeType.REMOVE, fetch=FetchType.LAZY, mappedBy="publication")
	private List<Translation> translations = new LinkedList<Translation>();
	
	public Article getPublication() {
		return publication;
	}
	
	public void setPublication(Article publication) {
		this.publication = publication;
	}
	
	public List<Translation> getTranslations() {
		return translations;
	}
	
	public void setTranslations(List<Translation> translations) {
		this.translations = translations;
	}
}